#ifndef _HISTORY_DIGEST_HPP
#define _HISTORY_DIGEST_HPP 1

#include <boost/shared_ptr.hpp>
#include "CommandBatch.hpp"
#include "NonDeterminism.hpp"
#include "Digest.hpp"

namespace BFT
{
	namespace messages
	{
		class HistoryDigest : public Digest
		{
		
			public:
			
			HistoryDigest(boost::shared_ptr<HistoryDigest> _history, 
				      boost::shared_ptr<CommandBatch> _batch,
				      boost::shared_ptr<NonDeterminism> _nondet,
				      boost::shared_ptr<Digest> _digest);
			
			HistoryDigest(boost::shared_ptr<HistoryDigest> _history, 
				      boost::shared_ptr<CommandBatch> _batch,
				      boost::shared_ptr<NonDeterminism> _nondet);

			HistoryDigest(boost::shared_ptr<char> _bytes, int _bytes_size);
			
			HistoryDigest();
			
			static boost::shared_ptr<HistoryDigest> fromBytes(boost::shared_ptr<char> _bytes, int _bytes_size);
			
			private:
			
			static boost::shared_ptr<char> combineArrays (boost::shared_ptr<char> _array1, int _array1_size,
								      boost::shared_ptr<char> _array2, int _array2_size,
								      boost::shared_ptr<char> _array3, int _array3_size,
								      boost::shared_ptr<char> _array4, int _array4_size);
								      
			static boost::shared_ptr<char> combineArrays (boost::shared_ptr<char> _array1, int _array1_size,
								      boost::shared_ptr<char> _array2, int _array2_size,
								      boost::shared_ptr<char> _array3, int _array3_size);
		
		};
	}
}

#endif
